package net.kong.sns.rest.client.message;

import net.kong.sns.rest.client.method.JsonMethodInvokeBase;
import net.kong.sns.rest.client.rest.HttpResponseContent;
import net.kong.sns.rest.client.InvalidResponseException;
import net.kong.sns.rest.client.KongApiMethod;

/**
 * @author <a href="mailto:lanhuai@gmail.com">Ning Yubin</a>
 * @version $Id: SendMessageMethodInvoke.java,v 1.5 2009/11/04 17:17:39 ningyubin Exp $
 */
public class SendMessageMethodInvoke extends JsonMethodInvokeBase<Boolean>{

    public SendMessageMethodInvoke(long receiverId, String content, Long replyId, String sessionKey) {
        this(receiverId, content, sessionKey);
        if (replyId != null && replyId != 0) {
            setParameter("reply_id", String.valueOf(replyId));
        }
    }

    public SendMessageMethodInvoke(long receiverId, String content, String sessionKey) {
        super(KongApiMethod.MESSAGE_SEND, sessionKey);
        setParameter("receiver", String.valueOf(receiverId));
        setParameter("content", content);
    }

    @Override
    protected Boolean processJsonResponse(HttpResponseContent responseData) throws InvalidResponseException {
        return true;
    }
}
